// 代码块 importM
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: Text("你好Flutter"),
          ),
          body: const Column(
            children: [
              MyApp(),
              MyButton(),
              MyText()
            ],
          )
        )
      )
    );
}

// 代码块 statelessW
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Center(
            child: Container(
              alignment: Alignment.center,
              width: 200, 
              height: 200,
              // transform: Matrix4.translationValues(-40, 0, 0), // 位移 x, y, z
              // transform: Matrix4.rotationZ(0.2), // 旋转
              // transform: Matrix4.skewY(20), // 扭曲
              decoration: BoxDecoration(
                color: Colors.yellow, // 背景颜色
                border: Border.all(color: Colors.red, width: 2), // 配置边框
                borderRadius: BorderRadius.circular(10), // 配置圆角 100是圆形
                boxShadow: const [
                  BoxShadow(color: Colors.blue, blurRadius: 10.0, )
                ], // 配置阴影
                gradient: const LinearGradient(colors: [Colors.red, Colors.yellow]) // 渐变
              ),
              child: const Text("你好Flutter", style: TextStyle(color: Colors.black, fontSize: 20)),
            ),
          );
  }

}

class MyButton extends StatelessWidget {
  const MyButton({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      width: 200,
      height: 40,
      // margin: const EdgeInsets.all(10),
      margin: const EdgeInsets.fromLTRB(0, 20, 0, 0),
      padding: const EdgeInsets.fromLTRB(40, 0, 0, 0),
      decoration: BoxDecoration(
        color: Colors.blue,
        borderRadius: BorderRadius.circular(20),
      ),
      child: 
        const Text("按钮", style: TextStyle(
          color: Colors.white
        ))
      ,
    );
  }
}

class MyText extends StatelessWidget {
  const MyText({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 200,
      height: 200,
      margin: const EdgeInsets.fromLTRB(0, 20, 0, 0),
      decoration: const BoxDecoration(
        color: Colors.yellow,
      ),
      child: const Text("你好我是Flutter你好我是Flutter你好我是Flutter你好我是Flutter你好我是Flutter", textAlign: TextAlign.center,
        maxLines: 1, overflow: TextOverflow.ellipsis,
        style: TextStyle(
          fontSize: 20.0,
          fontWeight: FontWeight.bold, // 加粗
          color: Colors.red,
          fontStyle: FontStyle.italic, // 倾斜
          letterSpacing: 5, // 字间距
          decoration: TextDecoration.underline, // 下划线
          decorationColor: Colors.black, // 下划线颜色
          decorationStyle: TextDecorationStyle.dashed, // 虚线
        ),),
    );
  }
}